file(GLOB test_format_src "*.cpp" "*.hpp")
add_executable(test_format ${test_format_src})
configure_test(test_format)

# For #include <stacktrace>
if(LINUX)
    include(CheckIncludeFileCXX)
    check_include_file_cxx("stacktrace" stdlib_has_stacktrace)
    if(${stdlib_has_stacktrace})
        if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14.0)
            if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
                target_link_libraries(test_format PRIVATE stdc++_libbacktrace)
            endif()
        else()
            target_link_libraries(test_format PRIVATE stdc++exp)
        endif()
    endif()
endif()
